import os
import sys


rootdir=r"Z:\all"

f1 = open(r'z:\all.txt', 'r+',encoding='utf')
for root, dirs, files in os.walk(rootdir, topdown=False):
    for name in files:
        print(os.path.join(root, name))
        filename=os.path.join(root, name)
        f = open(os.path.join(root, name), encoding='utf')
        t=f.read()
        f.close()

        f1.write(filename)
        f1.write("\r\n")
        f1.write(t)
        f1.write("\r\n\r\n---------------------------------\r\n")
f1.close()
